﻿
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace WinnerCMS.Data.Mapping
{
    public partial class PhotoListMap
        : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<WinnerCMS.Model.PhotoList>
    {
        public PhotoListMap()
        {
            // table
            //ToTable("CMS_PhotoList");

            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.ContentId)
                
                .IsRequired();
            Property(t => t.Title)
                
                .HasMaxLength(50)
                .IsOptional();
            Property(t => t.ThumbUrl)
                .IsUnicode(false)
                .HasMaxLength(255)
                .IsRequired();
            Property(t => t.PicUrl)
                .IsUnicode(false)
                .HasMaxLength(255)
                .IsRequired();
            Property(t => t.CreateTime)
                
                .IsRequired();
            Property(t => t.UpdateTime)
                
                .IsRequired();
            Property(t => t.TempFlag)
                .IsUnicode(false)
                .HasMaxLength(36)
                .IsOptional();
            Property(t => t.OrderId)
                
                .IsRequired();

            // Relationships
            HasRequired(t => t.ContentPhoto)
                .WithMany(t => t.ContentPhotoLists)
                .HasForeignKey(d => d.ContentId);

            //InitializeMapping();
        }
    }
}

